class Solution {
public:
    bool detectCapitalUse(string word) {
        int f1 = 0, f2 = 0;
        for (auto x : word) {
            if (x >= 'a' && x <= 'z') f1++;
            else f2++;
        }
        if (f1 && f2) {
            if (word.size() >= 2 && word[0] >= 'A' && word[0] <= 'Z' && f2 == 1)return 1;
            return 0;
        }
        return 1;
    }
};